<template>
    <div class="breadCrumbNavigation">
      <div class="left-content">
        <span :class="props.spanBgcolor != ''? 'active':''">{{props.title}}</span>
        <van-icon name="arrow" size="14" v-if="props.showRightIcon" />
      </div>
      <div class="right-content">
        <van-icon name="add-o" size="18" @click="handleClick" v-if="props.showAddIcon" />
      </div>
    </div>
</template>

<script setup>
import { ref } from "vue"
const props = defineProps({
  // 标题
  title: {
    type: String,
    default: '',
  },
  // 是否展示标题右侧箭头
  showRightIcon: {
    type: Boolean,
    default: true,
  },
  // 是否展示右侧添加按钮
  showAddIcon: {
    type: Boolean,
    default: false,
  },
  // 是否展示标题颜色
  spanBgcolor: {
    type: String,
    default: ''
  }
});
const emits = defineEmits(["add"]);
const handleClick = ()=>{
  emits("add");
}
</script>

<style lang="less" scoped>
.breadCrumbNavigation{
  width: 100%;
  height: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--primary-font-family);
  font-weight: var(--primary-font-weight);
  color: var(--primary-font-color);
  .left-content{
    position: relative;
    left: 10px;
    span.active::before{
      content: '';
      position: absolute;
      left: -10px;
      width: 6px;
      height: 18px;
      border-radius: 4px;
      background-color:  v-bind('props.spanBgcolor');
    }
  }
}

</style>
